goods_number=0
Flag=False
def getUseNameandpassword(userdict) :
    with open("Customer.txt",mode="r",encoding="UTF-8") as f :
        for line in f :
            #print(line)
            strusers=line.split(";")
            #print(strusers)
            if strusers==[] :
                print("no user")
            else :
                userdict[strusers[0]]= strusers[1].strip("\n")
    #print(userdict)
    return userdict

def Login(func) :
    def inner(*args,**kwargs) :
        global Flag
        userdict = {}
        getUseNameandpassword(userdict)

        if Flag :
            ret = func(*args, **kwargs)
            return ret
        else :
            strname = input("请输入你的名字：")
            strpassword = input("请输入你的密码:")
            if strname in userdict.keys() and strpassword == userdict[strname] :
                print("登录成功！")
                Flag=True
                ret = func(*args, **kwargs)
                return ret
            else :
                print("登录失败")
    return inner

@Login
def Stroe_add() :
    global goods_number
    goods_number+=1
    print("添加一个商品，商品的数量是：%d" %(goods_number))
    return goods_number

@Login
def Stroe_del() :
    global goods_number
    goods_number -= 1
    print("删除一个商品商品，商品还剩：%d" %(goods_number))
    return goods_number

Stroe_add()
Stroe_del()